/*
 * File: integrator.c
 *
 * Code generated for Simulink model 'integrator'.
 *
 * Model version                  : 4.0
 * Simulink Coder version         : 9.5 (R2021a) 14-Nov-2020
 * C/C++ source code generated on : Tue Dec 21 10:51:59 2021
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: Intel->x86-64 (Windows64)
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#include "integrator.h"

/* Macros for accessing real-time model data structure */
#ifndef rtmGetErrorStatus
#define rtmGetErrorStatus(rtm)         (*((rtm)->errorStatus))
#endif

#ifndef rtmSetErrorStatus
#define rtmSetErrorStatus(rtm, val)    (*((rtm)->errorStatus) = (val))
#endif

#ifndef rtmGetErrorStatusPointer
#define rtmGetErrorStatusPointer(rtm)  (rtm)->errorStatus
#endif

#ifndef rtmSetErrorStatusPointer
#define rtmSetErrorStatusPointer(rtm, val) ((rtm)->errorStatus = (val))
#endif

/* Output and update for referenced model: 'integrator' */
void integrator(const real_T *rtu_In1, real_T *rty_Out1, integrator_DW_f
                *localDW)
{
  /* DiscreteIntegrator: '<Root>/Integrator' */
  *rty_Out1 = localDW->Integrator_DSTATE;

  /* Update for DiscreteIntegrator: '<Root>/Integrator' */
  localDW->Integrator_DSTATE += 2.0 * *rtu_In1;
}

/* Model initialize function */
void integrator_initialize(const char_T **rt_errorStatus, integrator_RT_MODEL *
  const integratorrtM)
{
  /* Registration code */

  /* initialize error status */
  rtmSetErrorStatusPointer(integratorrtM, rt_errorStatus);
}

/*
 * File trailer for generated code.
 *
 * [EOF]
 */
